<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="购物车, 购物篮, 购物清单" />
<meta name="description" content="我的购物车" />
<title>我的购物车 - <{$common.site_name}></title>
<link rel="stylesheet" type="text/css" href="<{$common.theme}>/style/general.css" />
<link rel="stylesheet" type="text/css" href="<{$common.theme}>/style/order.css" />
<script type="text/javascript" src="<{$common.theme}>/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="<{$common.theme}>/js/general.js"></script>
<script type="text/javascript" src="<{$common.theme}>/js/juicer.js"></script>
<script type="text/javascript" src="<{$common.theme}>/js/cart.js"></script>
<script type="text/javascript">
function checkout(){
  var key = [], qty = [];
  $('.cart-row').each(function(i, e){
    key[i] = $(e).data('key')
    qty[i] = $(e).find('.qty input').val();
  });
  $.ajax({
    type: "post",
    dataType: "text",
    url: "<{url c='order' a='cart' step='checkout'}>",
    data: {'key':key, 'qty': qty},
    beforeSend:function(){$('#checkout-btn').text('正在提交...');},	
    success: function(data){
      if(data == 1){
        window.location.href = "<{url c='order' a='confirm'}>";
      }else{
        alert('提交失败，请重试！');
        $('#checkout-btn').text('去结算');
      }
    },
    error:function(){$('#checkout-btn').text('去结算');alert('请求出错！');}
  });
}
</script>
</head>
<body>
<!-- 顶部开始 -->
<{layout_topper common=$common}>
<!-- 顶部结束 -->
<!-- 头部开始 -->
<div class="header">
  <div class="w1100 cut">
    <div class="logo fl"><a href="<{$common.url}>"><img title="Verydows" src="<{$common.theme}>/images/logo.gif" /></a></div>
    <div class="step cut">
      <ul>
        <li class="cur">我的购物车</li>
        <li>填写订单</li>
        <li>完成付款</li>
      </ul>
    </div>
  </div>
</div>
<!-- 头部结束 -->
<!-- 主体开始 -->
<div class="container w1100 mt30">
  <{if !empty($cart.item)}>
  <div class="module cut">
    <div class="cart">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <th colspan="2">商品</th>
          <th width="130">价格(元)</th>
          <th width="150">数量</th>
          <th width="130">小计(元)</th>
          <th width="130">操作</th>
        </tr>
        <{foreach $cart.item as $k => $v}>
        <tr class="cart-row" data-key="<{$k}>">
          <td width="80"><a href="<{url c='goods' a='index' id=$v.goods_id}>" target="_blank"><img class="gim" src="<{url c='image' a='index' i=$v.goods_image s='50x50'}>" /></a></td>
          <td>
            <div class="aln-l">
              <a href="<{url c='goods' a='index' id=$v.goods_id}>" target="_blank"><{$v.goods_name}></a>
              <p class="opts c999 mt5"><{foreach $v.opts as $vv}><span class="mr5">[<{$vv.type}>: <font class="c666"><{$vv.opt_text}></font>]</span><{/foreach}></p>
            </div>
          </td>
          <td><font class="unit-price"><{$v.now_price}></font></td>
          <td class="qty"><button type="button">-</button><input class="aln-c" type="text" value="<{$v.qty}>" data-stock="<{$v.stock_qty}>" /><button type="button">+</button></td>
          <td><font class="subtotal red"><{$v.subtotal}></font></td>
          <td><a class="remove-row">删除</a></td>
        </tr>
        <{/foreach}>
      </table>
    </div>
    <div class="module mt10 cut">
      <div class="clear-cart fl"><a id="clear-cart"><i class="icon"></i>清空购物车</a></div>
      <div class="cart-bill fr cut">
        <dl>
          <dt>您的购物车中有 <b id="item-count">0</b> 种商品，总价：</dt>
          <dd id="subtotal-adding"></dd>
        </dl>
        <dl class="tot mt5">
          <dt>共计(不含运费)：</dt>
          <dd><b class="red">¥</b><font class="red" id="total">0.00</font></dd>
        </dl>
        <div class="aln-r mt20"><a class="checkout-btn radius4" id="checkout-btn" onclick="checkout()">去结算</a></div>
      </div>
    </div>
    <!-- 确定提示对话框开始 -->
    <div class="vds-sure radius4 cut" id="sure-dialog">
      <p></p>
      <div class="mt10">
        <button type="button" class="sm-blue">确定</button>
        <button type="button" class="sm-gray">取消</button>
      </div>
    </div>
    <!--确定提示对话框结束 -->
  </div>
  <{else}>
  <div class="cart-empty cut">
    <p class="c666">您的购物车是空的！<a href="<{$common.url}>">快去逛一逛</a>，找到您喜欢的商品放进购物车吧。</p>
  </div>
  <{/if}> </div>
<!-- 主体结束 -->
<div class="cl"></div>
<!-- 页脚开始 -->
<{layout_footer}>
<!-- 页脚结束 -->
<!-- Loading对话框开始 -->
<div class="vds-loading" id="vds-loading">
  <dl>
    <dt></dt>
    <dd></dd>
  </dl>
</div>
<div class="mask" id="mask"></div>
<!-- Loading对话框结束 -->
</body>
</html>